package com.turing.model.registry.controller;

import com.turing.common.response.ResponseVO;
import com.turing.common.util.ResponseUtil;
import com.turing.common.util.Tools;
import com.turing.model.registry.service.RegisterInstanceService;
import com.turing.model.registry.vo.RegisteredInstanceVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
* @Description Controller
* @Author livin
* @Date 2022-01-24
*/
@RestController
@RequestMapping("/registry")
@Validated
public class RegisterInstanceController {

    private String OCR_INSTANCE = "ocr_instance_";

    /**
    *接口
    **/
    @Autowired
    private RegisterInstanceService registerInstanceService;

    @PostMapping("/registerOrRenew")
    public ResponseVO<Object> registerOrRenew( @RequestBody @Valid RegisteredInstanceVO registeredInstanceVO){
        if(Tools.isEmpty(registeredInstanceVO.getGpu_info())){
            return ResponseUtil.success();
        }
        registerInstanceService.registerOrRenew(registeredInstanceVO);
        return ResponseUtil.success();

    }

}